package umls.geneus.core.sax;

import java.util.LinkedList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;



public class PubmedIdParser extends DefaultHandler {
	//List<PubMedAbstractMapped> result_list;
	private List<String> ids = null;
	boolean id_flag = false;

	public PubmedIdParser() {

		ids = new LinkedList<String>();
	}

	public void startElement(String namespaceURI, String localName,
			String qName, Attributes atts) throws SAXException {
		if (qName.equalsIgnoreCase("Id")) {
			id_flag=true;
		}
		

	}

	public void characters(char[] ch, int start, int length)
			throws SAXException {
		if (id_flag) {
		String 	id = new String(ch, start, length);
			ids.add(id);
			
			id_flag = false;
		}

	}

	public List<String> getIds() {
		return ids;
	}
}
